package com.jingding.procurement;

import com.jingding.procurement.pojo.entity.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.io.*;

@EnableScheduling
@SpringBootApplication
@EnableAsync
public class ProcurementApplication {

    public static void main(String[] args) throws IOException, ClassNotFoundException {
        String disable = "Y";//启用Y  不启用N
        String taskTime = "08:42:00";//执行时间
        String firstTime = "24:00:00";//首次执行时间
        String startTime = "2024-05-04 00:00:00";//查询起时
        String endTime = "2024-05-04 06:04:00";//查询止时


        ProcurementContractEntity procurementContractEntity = new ProcurementContractEntity();
        procurementContractEntity.setDisable(disable);
        procurementContractEntity.setTaskTime("12:00:00");
        procurementContractEntity.setFirstTime("00:00:00");
        procurementContractEntity.setStartTime(startTime);
        procurementContractEntity.setEndTime(endTime);


        PurchaseOrdersEntity purchaseOrdersEntity = new PurchaseOrdersEntity();
        purchaseOrdersEntity.setDisable(disable);
        purchaseOrdersEntity.setTaskTime("12:05:00");
        purchaseOrdersEntity.setFirstTime("00:05:00");
        purchaseOrdersEntity.setStartTime(startTime);
        purchaseOrdersEntity.setEndTime(endTime);


        PurchasePoundsEntity purchasePoundsEntity = new PurchasePoundsEntity();
        purchasePoundsEntity.setDisable(disable);
        purchasePoundsEntity.setTaskTime(taskTime);
        purchasePoundsEntity.setFirstTime(firstTime);
        purchasePoundsEntity.setStartTime(startTime);
        purchasePoundsEntity.setEndTime(endTime);


        SellOutEntity sellOutEntity = new SellOutEntity();
        sellOutEntity.setDisable(disable);
        sellOutEntity.setTaskTime(taskTime);
        sellOutEntity.setFirstTime(firstTime);
        sellOutEntity.setStartTime(startTime);
        sellOutEntity.setEndTime(endTime);

        SupplierInspectionSheetEntity supplierInspectionSheetEntity = new SupplierInspectionSheetEntity();
        supplierInspectionSheetEntity.setDisable(disable);
        supplierInspectionSheetEntity.setTaskTime("12:10:00");
        supplierInspectionSheetEntity.setFirstTime("00:10:00");
        supplierInspectionSheetEntity.setStartTime(startTime);
        supplierInspectionSheetEntity.setEndTime(endTime);

        TonnageEntity tonnageEntity = new TonnageEntity();
        tonnageEntity.setDisable(disable);
        tonnageEntity.setTaskTime("12:15:00");
        tonnageEntity.setFirstTime("00:15:00");
        tonnageEntity.setStartTime(startTime);
        tonnageEntity.setEndTime(endTime);


        FileOutputStream pcFos = new FileOutputStream("procurementContractEntity.txt");
        ObjectOutputStream pcOos = new ObjectOutputStream(pcFos);
        pcOos.writeObject(procurementContractEntity);
        System.out.println("procurementContractEntity---------修改完成" + procurementContractEntity);
        pcOos.close();
        FileInputStream pcFis = new FileInputStream("procurementContractEntity.txt");
        ObjectInputStream pcOis = new ObjectInputStream(pcFis);
        ProcurementContractEntity procurementContractEntityEntity1 = (ProcurementContractEntity) pcOis.readObject();
        System.out.println("查看 " + procurementContractEntityEntity1);
        pcOis.close();


        FileOutputStream poFos = new FileOutputStream("purchaseOrdersEntity.txt");
        ObjectOutputStream poOos = new ObjectOutputStream(poFos);
        poOos.writeObject(purchaseOrdersEntity);
        System.out.println("purchaseOrdersEntity----------修改完成" + purchaseOrdersEntity);
        poOos.close();
        FileInputStream poFis = new FileInputStream("purchaseOrdersEntity.txt");
        ObjectInputStream poOis = new ObjectInputStream(poFis);
        PurchaseOrdersEntity purchaseOrdersEntity1 = (PurchaseOrdersEntity) poOis.readObject();
        System.out.println("查看 " + purchaseOrdersEntity1);
        poOis.close();


        FileOutputStream ppFos = new FileOutputStream("purchasePoundsEntity.txt");
        ObjectOutputStream ppOos = new ObjectOutputStream(ppFos);
        ppOos.writeObject(purchasePoundsEntity);
        System.out.println("purchasePoundsEntity---------修改完成" + purchasePoundsEntity);
        ppOos.close();
        FileInputStream ppFis = new FileInputStream("purchasePoundsEntity.txt");
        ObjectInputStream ppOis = new ObjectInputStream(ppFis);
        PurchasePoundsEntity purchasePoundsEntity1 = (PurchasePoundsEntity) ppOis.readObject();
        System.out.println(purchasePoundsEntity1);
        ppOis.close();


        FileOutputStream soFos = new FileOutputStream("sellOutEntity.txt");
        ObjectOutputStream soOos = new ObjectOutputStream(soFos);
        soOos.writeObject(sellOutEntity);
        System.out.println("sellOutEntity----------修改完成" + sellOutEntity);
        soOos.close();
        FileInputStream soFis = new FileInputStream("sellOutEntity.txt");
        ObjectInputStream soOis = new ObjectInputStream(soFis);
        SellOutEntity sellOutEntity1 = (SellOutEntity) soOis.readObject();
        System.out.println(sellOutEntity1);
        soFis.close();


        FileOutputStream slFos = new FileOutputStream("supplierInspectionSheetEntity.txt");
        ObjectOutputStream slOos = new ObjectOutputStream(slFos);
        slOos.writeObject(supplierInspectionSheetEntity);
        System.out.println("supplierInspectionSheetEntity----------修改完成" + supplierInspectionSheetEntity);
        slOos.close();
        FileInputStream slFis = new FileInputStream("supplierInspectionSheetEntity.txt");
        ObjectInputStream slOis = new ObjectInputStream(slFis);
        SupplierInspectionSheetEntity supplierInspectionSheetEntity1 = (SupplierInspectionSheetEntity) slOis.readObject();
        System.out.println(supplierInspectionSheetEntity1);
        slOis.close();


        FileOutputStream tFos = new FileOutputStream("tonnageEntity.txt");
        ObjectOutputStream tOos = new ObjectOutputStream(tFos);
        tOos.writeObject(tonnageEntity);
        System.out.println("tonnageEntity----------修改完成" + tonnageEntity);
        tOos.close();
        FileInputStream tFis = new FileInputStream("tonnageEntity.txt");
        ObjectInputStream tOis = new ObjectInputStream(tFis);
        TonnageEntity tonnageEntity1 = (TonnageEntity) tOis.readObject();
        System.out.println(tonnageEntity1);
        tOis.close();


        SpringApplication.run(ProcurementApplication.class, args);
    }

}
